package com.bzyd.cloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试Nacos配置中心动态刷新功能
 * Created by Xianyue Dang on 2021/8/20
 */
@RestController
@RefreshScope  // 开启配置动态刷新
public class NacosConfigController {

    @Value("${config.appName:null}")
    private String appName;

    @Value("${config.env:null}")
    private String env;

    @GetMapping("/nacos-config-test1")
    public String test1() {
        return appName;
    }

    @GetMapping("/nacos-config-test2")
    public String test2() {
        return env;
    }
}
